<?php namespace Summer\Userhub\Updates;

use Schema;
use Winter\Storm\Database\Updates\Migration;

class BuilderTableCreateSummerUserhubOauth extends Migration
{
    public function up()
    {
        Schema::create('summer_userhub_oauth', function($table)
        {
            $table->engine = 'InnoDB';
            $table->increments('id')->unsigned();
            $table->timestamp('created_at')->nullable();
            $table->timestamp('updated_at')->nullable();
            $table->integer('user_id')->nullable();
            $table->string('provider');
            $table->string('platform');
            $table->string('unionid')->nullable();
            $table->string('openid');
            $table->string('nickname')->nullable();
            $table->smallInteger('sex')->nullable();
            $table->string('country')->nullable();
            $table->string('province')->nullable();
            $table->string('city')->nullable();
            $table->string('headimgurl', 500)->nullable();
            $table->integer('logintime')->nullable();
            $table->integer('logincount')->nullable();
            $table->integer('expire_in')->nullable();
            $table->integer('expiretime')->nullable();
            $table->string('session_key')->nullable();
            $table->string('refresh_token')->nullable();
            $table->string('access_token')->nullable();
        });
    }
    
    public function down()
    {
        Schema::dropIfExists('summer_userhub_oauth');
    }
}
